package com.baselibrary.test.ui;

import android.os.Bundle;

import com.baselibrary.libs.Utils.Toast.UtilsToast;
import com.baselibrary.libs.View.bar.initAction_Bar;
import com.baselibrary.libs.View.defined.defined_viewpager_banner.Defined_ViewPager_Banner;
import com.baselibrary.libs.base.baseActivity.BaseActivity;
import com.baselibrary.libs.base.baseAdapter.BaseViewPagerAdapter;
import com.baselibrary.libs.example.example_ViewPage_banner.bean.Banner;
import com.baselibrary.test.R;
import com.baselibrary.test.app.AppContext;

import java.util.ArrayList;

/**2
 * 广告图activity
 */
public class Main2Activity extends BaseActivity {

    private Defined_ViewPager_Banner viewpager_banner;
    private initAction_Bar action_bar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        allowPrintscreen(1);
        super.onCreate(savedInstanceState);
    }

    @Override
    public int getlayouXML() {
        return R.layout.activity_main2;
    }

    @Override
    public void initP() {

    }



    @Override
    public void initView() {
        viewpager_banner = (Defined_ViewPager_Banner) findViewById(R.id.viewpager_banner);
        action_bar = (initAction_Bar) findViewById(R.id.action_bar);


        action_bar.set_Title("广告图");
        initData();
    }

    @Override
    public void initData() {
        //获取了数据
        ArrayList<Banner> paths = new ArrayList<>();
        paths.add(new Banner("http://pic.yesky.com/uploadImages/2015/026/38/MG734XC8AM7T.jpg"));
        paths.add(new Banner("http://www.gamemei.com/background/uploads/160829/30-160R9143H3343.jpg"));
        paths.add(new Banner("http://www.gamemei.com/background/uploads/160829/30-160R9143612P5.jpg"));
        paths.add(new Banner("http://img3.duitang.com/uploads/item/201608/20/20160820091508_diTXf.thumb.700_0.jpeg"));
        paths.add(new Banner("http://joymepic.joyme.com/article/uploads/allimg/201609/1473906749455425.jpg?watermark/1/image/aHR0cDovL2pveW1lcGljLmpveW1lLmNvbS9hcnRpY2xlL3VwbG9hZHMvMTYwODE5LzgwLTE2MFE5MUZaMzQzOC5wbmc=/dissolve/70"));
        //赋值
        viewpager_banner.initData(AppContext.getApplication(), paths, new BaseViewPagerAdapter.CallBack() {
            @Override
            public void onItemPos(int pos) {
                UtilsToast.showToast(AppContext.getApplication(),"我点了条目"+pos);
            }
        });
    }

    @Override
    public void initListener() {

    }

}
